package com.example.edianzu.somur.module.mine.adapter;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.view.View;
import android.view.ViewGroup;

import com.example.edianzu.somur.R;
import com.example.edianzu.somur.module.mine.bean.SampleList;
import com.example.edianzu.somur.utils.adaptetr.BaseListViewAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * author：风不会停息 on 2017/7/19 18:29
 * mailbox：yh131412hys@163.com
 * project：Somur
 * tel：13295355900
 * describe：
 */

public class SampleListListViewAdapter extends BaseListViewAdapter<SampleList.DataBean> {

    public SampleListListViewAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder;
        if (convertView == null) {

            convertView = getLayoutInflater().inflate(R.layout.item_sample, parent, false);
            viewHolder=new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {

            viewHolder= (ViewHolder) convertView.getTag();
        }

        viewHolder.listItemSampleSn.setText(getItem(position).getSample_sn());
        viewHolder.listItemSuitTitle.setText(getItem(position).getSuit_title());
        return convertView;
    }

    static class ViewHolder {
        @BindView(R.id.list_item_sample_sn)
        AppCompatTextView listItemSampleSn;
        @BindView(R.id.list_item_suit_title)
        AppCompatTextView listItemSuitTitle;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
